package game;

import gui.GameFrame;

import java.util.ArrayList;


import utilities.Constantes;


import manager.universe.PhisicManager;
import manager.universe.RenderManager;
import manager.universe.UniverseManager;

public class Game {
	
	ArrayList<UniverseManager> managers = new ArrayList<UniverseManager>();
	
	private static Game instance;

	
	
	
	
	public static Game getInstance(){
		if(instance == null)
			instance = new Game();
		return instance;
	}
	
	private Game(){
		managers.add(new RenderManager(Constantes.RENDER_MANAGER_PERIODE));
		managers.add(new PhisicManager(Constantes.PHISIC_MANAGER_PERIODE));
		
		GameFrame.getInstance();
		
		for(UniverseManager manager : managers)
			(new Thread(manager)).start();
		
	}
	

	

	public void kill(){
		for(UniverseManager manager : managers)
			manager.kill();
		System.out.println("Game has been killed");
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Game.getInstance();
	}
	
}


